{
 "cells": [
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-08T02:57:41.310944Z",
     "start_time": "2024-12-08T02:57:41.295354Z"
    }
   },
   "source": [
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import os\n",
    "\n",
    "from matplotlib import pyplot\n",
    "from numpy import dtype\n",
    "from tensorflow.keras import layers"
   ],
   "outputs": [],
   "execution_count": 3
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-08T02:58:01.807800Z",
     "start_time": "2024-12-08T02:57:42.333348Z"
    }
   },
   "source": [
    "# 说明\n",
    "'''\n",
    "导入data文件夹里的test.csv和train.csv里的数据\n",
    "train.csv里有42000行数据，test.csv里有28000行数据\n",
    "每行数据第一列是标签，后面784列是图片的像素值\n",
    "每张图片是28*28像素的灰度图\n",
    "标签是0-9的数字，代表图片上的数字\n",
    "像素值是0-255的数字，代表图片上每个像素的灰度值\n",
    "train.csv里的数据用于训练模型\n",
    "test.csv里的数据用于测试模型\n",
    "'''\n",
    "train_data = np.loadtxt('data/train.csv', delimiter=',', skiprows=1)\n",
    "test_data = np.loadtxt('data/test.csv', delimiter=',', skiprows=1)\n",
    "# 想办法处理一下数据，你可能需要把标签和图片分开"
   ],
   "outputs": [],
   "execution_count": 4
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-08T02:58:04.127643Z",
     "start_time": "2024-12-08T02:58:04.109661Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# print(type(train_data[0][0]))  # float\n",
    "train_pixel = train_data[...,1:]\n",
    "train_label = train_data[...,0]\n",
    "# train_label = train_label.astype('int32')"
   ],
   "outputs": [],
   "execution_count": 5
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-08T02:58:06.317380Z",
     "start_time": "2024-12-08T02:58:06.211448Z"
    }
   },
   "cell_type": "code",
   "source": [
    "train_pixel = train_pixel / 255.0\n",
    "test_pixel = test_data / 255.0\n"
   ],
   "outputs": [],
   "execution_count": 6
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-08T03:12:00.818761Z",
     "start_time": "2024-12-08T03:12:00.807604Z"
    }
   },
   "source": [
    "# 使用卷积神经网络训练数据\n",
    "# 定义一个函数，用于训练模型\n",
    "def train_model(train_pixel, train_label):\n",
    "    model = tf.keras.models.Sequential([\n",
    "    ])\n",
    "    model.add(layers.Dense(128, activation='relu',input_shape=(784,)))\n",
    "    model.add(layers.Dense(64, activation='relu'))\n",
    "    model.add(layers.Dense(32, activation='relu'))\n",
    "    model.add(layers.Dense(10, activation='softmax'))\n",
    "    model.compile(optimizer=tf.keras.optimizers.Adam(0.001),\n",
    "                  loss = tf.keras.losses.SparseCategoricalCrossentropy(),\n",
    "                  metrics = [tf.keras.metrics.SparseCategoricalAccuracy()]\n",
    ")\n",
    "    model.fit(train_pixel,train_label,epochs=10,batch_size=32, validation_split=0.1)\n",
    "    return model\n",
    "    # 定义模型，之后的就由你完成吧！"
   ],
   "outputs": [],
   "execution_count": 17
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-08T03:12:22.648718Z",
     "start_time": "2024-12-08T03:12:02.743429Z"
    }
   },
   "cell_type": "code",
   "source": [
    "if __name__ == '__main__':\n",
    "    train_model(train_pixel, train_label)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.2992 - sparse_categorical_accuracy: 0.9098 - val_loss: 0.1450 - val_sparse_categorical_accuracy: 0.9569\n",
      "Epoch 2/10\n",
      "1182/1182 [==============================] - 2s 1ms/step - loss: 0.1224 - sparse_categorical_accuracy: 0.9632 - val_loss: 0.1230 - val_sparse_categorical_accuracy: 0.9605\n",
      "Epoch 3/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0810 - sparse_categorical_accuracy: 0.9741 - val_loss: 0.1210 - val_sparse_categorical_accuracy: 0.9655\n",
      "Epoch 4/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0627 - sparse_categorical_accuracy: 0.9801 - val_loss: 0.1047 - val_sparse_categorical_accuracy: 0.9710\n",
      "Epoch 5/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0489 - sparse_categorical_accuracy: 0.9838 - val_loss: 0.1095 - val_sparse_categorical_accuracy: 0.9660\n",
      "Epoch 6/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0416 - sparse_categorical_accuracy: 0.9867 - val_loss: 0.1074 - val_sparse_categorical_accuracy: 0.9688\n",
      "Epoch 7/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0315 - sparse_categorical_accuracy: 0.9900 - val_loss: 0.1104 - val_sparse_categorical_accuracy: 0.9688\n",
      "Epoch 8/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0296 - sparse_categorical_accuracy: 0.9903 - val_loss: 0.1121 - val_sparse_categorical_accuracy: 0.9690\n",
      "Epoch 9/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0249 - sparse_categorical_accuracy: 0.9917 - val_loss: 0.1272 - val_sparse_categorical_accuracy: 0.9693\n",
      "Epoch 10/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0214 - sparse_categorical_accuracy: 0.9923 - val_loss: 0.1293 - val_sparse_categorical_accuracy: 0.9683\n"
     ]
    }
   ],
   "execution_count": 18
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-08T03:12:52.653584Z",
     "start_time": "2024-12-08T03:12:30.426333Z"
    }
   },
   "cell_type": "code",
   "source": [
    "plt.imshow(test_data[2].reshape((28,28)), cmap='gray')\n",
    "trained_model = train_model(train_pixel, train_label)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.3143 - sparse_categorical_accuracy: 0.9039 - val_loss: 0.1755 - val_sparse_categorical_accuracy: 0.9469\n",
      "Epoch 2/10\n",
      "1182/1182 [==============================] - 2s 1ms/step - loss: 0.1226 - sparse_categorical_accuracy: 0.9625 - val_loss: 0.1350 - val_sparse_categorical_accuracy: 0.9593\n",
      "Epoch 3/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0838 - sparse_categorical_accuracy: 0.9729 - val_loss: 0.1071 - val_sparse_categorical_accuracy: 0.9662\n",
      "Epoch 4/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0621 - sparse_categorical_accuracy: 0.9798 - val_loss: 0.0998 - val_sparse_categorical_accuracy: 0.9695\n",
      "Epoch 5/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0503 - sparse_categorical_accuracy: 0.9844 - val_loss: 0.1106 - val_sparse_categorical_accuracy: 0.9681\n",
      "Epoch 6/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0362 - sparse_categorical_accuracy: 0.9882 - val_loss: 0.1159 - val_sparse_categorical_accuracy: 0.9707\n",
      "Epoch 7/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0330 - sparse_categorical_accuracy: 0.9893 - val_loss: 0.0986 - val_sparse_categorical_accuracy: 0.9738\n",
      "Epoch 8/10\n",
      "1182/1182 [==============================] - 2s 2ms/step - loss: 0.0300 - sparse_categorical_accuracy: 0.9894 - val_loss: 0.1099 - val_sparse_categorical_accuracy: 0.9719\n",
      "Epoch 9/10\n",
      "1182/1182 [==============================] - 3s 2ms/step - loss: 0.0268 - sparse_categorical_accuracy: 0.9915 - val_loss: 0.1064 - val_sparse_categorical_accuracy: 0.9738\n",
      "Epoch 10/10\n",
      "1182/1182 [==============================] - 3s 2ms/step - loss: 0.0224 - sparse_categorical_accuracy: 0.9928 - val_loss: 0.1281 - val_sparse_categorical_accuracy: 0.9688\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ],
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaEAAAGdCAYAAAC7EMwUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAaQ0lEQVR4nO3df2hV9/3H8df1R27V3dyRaXLvrTGEorQz4uaPqZn11zA1dDKbdqiFTTeQdlU7G4ubc5symCkypRv5qlQ2p1RXEayTKbXpYhLF2llRFNeJrbFmaAiKvTemep36+f4hXrzGqife6zv35vmAA8295+39eHrw6fHenPicc04AABjoZr0AAEDXRYQAAGaIEADADBECAJghQgAAM0QIAGCGCAEAzBAhAICZHtYLuNONGzd09uxZBQIB+Xw+6+UAADxyzqm1tVWRSETdut37WqfTRejs2bMqLCy0XgYA4CE1NTWpf//+99yn0/1zXCAQsF4CACAFHuTP87RFaPXq1SouLtZjjz2m4cOHa+/evQ80xz/BAUB2eJA/z9MSoS1btmjBggVasmSJDh8+rKefflrl5eU6c+ZMOl4OAJChfOm4i/aoUaM0bNgwrVmzJvHYU089pWnTpqmqquqes7FYTMFgMNVLAgA8YtFoVLm5uffcJ+VXQlevXtWhQ4dUVlaW9HhZWZn279/fbv94PK5YLJa0AQC6hpRH6Pz587p+/boKCgqSHi8oKFBzc3O7/auqqhQMBhMbn4wDgK4jbR9MuPMNKefcXd+kWrx4saLRaGJrampK15IAAJ1Myr9PqG/fvurevXu7q56WlpZ2V0eS5Pf75ff7U70MAEAGSPmVUE5OjoYPH66ampqkx2tqalRaWprqlwMAZLC03DGhsrJSP/rRjzRixAiNGTNGb731ls6cOaOXX345HS8HAMhQaYnQ9OnTdeHCBf3ud7/TuXPnVFJSol27dqmoqCgdLwcAyFBp+T6hh8H3CQFAdjD5PiEAAB4UEQIAmCFCAAAzRAgAYIYIAQDMECEAgBkiBAAwQ4QAAGaIEADADBECAJghQg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+xyGTzoeMiZBzzv3f//2fKyoqcjk5OW7YsGFJH0fsCqZPn+7C4bDr2bOni0QirqKiwh0/ftx6WWm3Z88eJ6ndNmvWLOfczY/lLl261IVCIef3+924cePcsWPHbBedBvc6Dl9++aUrKytz/fr1cz179nQDBgxws2bNcmfOnLFedkrd7fcvya1fvz6xT1c4H+53HDLpfOBHOQAAzGTEe0IAgOxEhAAAZogQAMAMEQIAmCFCAAAzRAgAYIYIAQDMECEAgBkiBAAwQ4QAAGaIEADADBECAJj5f1/s80PFDyzvAAAAAElFTkSuQmCC"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 19
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-08T03:14:51.082281Z",
     "start_time": "2024-12-08T03:14:50.031032Z"
    }
   },
   "cell_type": "code",
   "source": [
    "predictions = trained_model.predict(test_data)\n",
    "predictions_label = np.argmax(predictions, axis=1)\n",
    "print(predictions_label[2])"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "875/875 [==============================] - 1s 855us/step\n",
      "9\n"
     ]
    }
   ],
   "execution_count": 23
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
